/**
 * Created by zhangjinrui on 17/6/27.
 */

public class Solution576 {

    public static void main(String args[]) {
        Solution576 s = new Solution576();
        System.out.println(s.findPaths(1, 3, 3, 0, 1));
    }

    int mp[][][];

    public int findPaths(int m, int n, int N, int i, int j) {
        mp = new int[51][51][51];
        for (int a = 0; a < 51; a++) {
            for (int b = 0; b < 51; b++) {
                for (int k = 0; k < 51; k++) {
                    mp[a][b][k] = -1;
                }
            }
        }
        return dfs(m, n, i, j, 0, N);
    }


    public int dfs(int m, int n, int x, int y, int step, int N) {
        if (isOut(m, n, x, y) && step <= N) {
            return 1;
        }
        if (step == N) {
            return 0;
        }

        if (mp[x][y][step] != -1) {
            return mp[x][y][step];
        }

        int dx[] = new int[]{1, 0, -1, 0};
        int dy[] = new int[]{0, 1, 0, -1};
        int sum = 0;
        for (int i = 0; i < 4; i++) {
            sum = (sum + dfs(m, n, x + dx[i], y + dy[i], step + 1, N)) % 1000000007;
        }
        mp[x][y][step] = sum;
        return sum;
    }

    public boolean isOut(int m, int n, int x, int y) {
        if (x < 0 || x >= m || y < 0 || y >= n) {
            return true;
        }
        return false;
    }

}
